<!doctype html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
	<style type="text/css">

img{
	position:absolute;
	left:0px;
	top:0px;
}

	</style>
</head>
<body>
<img src="1.jpg" id="imgid">
</body>
<script type="text/javascript">
	imgobj=document.getElementById('imgid');
	xs=0;
	xv=30;
	ys=0;
	yv=30;
	document.onkeydown=function(event){
		kc=event.keyCode;
		document.title=kc;
		switch(kc){
		case 37:
              xs-=xv;
              imgobj.style.left=xs+'px'; 
              document.body.style.background='red';
			break;

		case 38:
		      ys-=yv
              imgobj.style.top=ys+'px';       
			break;
		case 39:
              xs+=xv;
              imgobj.style.left=xs+'px';
			break;
		case 40:
                ys+=yv;
                imgobj.style.top=ys+'px';

			break;
		}

	}
</script>
</html>